package com.solution.admin.product.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.solution.admin.product.dao.PromotionTagDao;
import com.solution.admin.product.entity.PromotionTagEntity;
import com.solution.admin.product.service.PromotionTagService;
import com.solution.common.dao.BaseDao;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;
import com.solution.common.service.impl.BaseServiceImpl;

/**
 * 商品-活动标签信息service实现层
 * 
 * @author xu_cc
 * @date 2017-10-16 19:14:41
 */
@Service
public class PromotionTagServiceImpl extends BaseServiceImpl<PromotionTagEntity> implements PromotionTagService {
    /**
     * 商品-活动标签信息接口
     */
    @Autowired
    private PromotionTagDao promotionTagDao;

    protected BaseDao<PromotionTagEntity> getDao() {
        return this.promotionTagDao;
    }

    /**
     * 保存商品-活动标签信息
     * 
     * @param promotionTagEntity
     *            商品-活动标签信息实体
     * @return Long 添加成功商品-活动标签信息的ID
     * @author xu_cc
     * @date 2017-10-16 19:14:41
     */
    public long savePromotionTag(PromotionTagEntity promotionTagEntity) {
        return promotionTagDao.savePromotionTag(promotionTagEntity);
    }

    /**
     * 分页查询商品-活动标签信息
     * 
     * @param pageParam
     *            分页参数
     * @param paramMap
     *            查询参数
     * @return PageBean 分页参数和分页数据
     * @author xu_cc
     * @date 2017-10-16 19:14:41
     */
    @Override
    public PageBean listPromotionTagPage(PageParam pageParam, Map<String, Object> paramMap) {
        return promotionTagDao.listPromotionTagPage(pageParam, paramMap);
    }

    /**
     * 根据ID查询用户信息
     * 
     * @param id
     *            用户id
     * @return promotionTagEntity 用户对象
     * @author xu_cc
     * @date 2017-10-16 19:14:41
     */
    public PromotionTagEntity getPromotionTagById(Long id) {
        return promotionTagDao.getById(id.longValue());
    }

    /**
     * 更新用户
     * 
     * @param promotionTagEntity
     *            用户实体
     * @return Long 更新是否成功，>1代表更新成功
     * @author xu_cc
     * @date 2017-10-16 19:14:41
     */
    @Override
    public int updatePromotionTag(PromotionTagEntity promotionTagEntity) {
        return promotionTagDao.updatePromotionTag(promotionTagEntity);
    }

    /**
     * 删除商品-活动标签信息
     * 
     * @param
     * @return int 返回删除记录条数
     * @author xu_cc
     * @date 2017-10-16 19:14:41
     */
    public int deletePromotionTagById(long id) {
        return promotionTagDao.deleteById(id);
    }

    @Override
    public List<PromotionTagEntity> listPromotionTag(Map<String, Object> param) {
        return promotionTagDao.listPromotionTag(param);
    }
}
